package com.Txunda.fxw.ui.adapter;


import com.Txunda.fxw.R;
import com.Txunda.fxw.ui.callback.MyItemClickListener;
import com.Txunda.fxw.ui.adapter.model.DetailRecyclerHolder;
import com.Txunda.fxw.ui.adapter.model.LawModel;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

public class Law_DetailAdapter extends RecyclerView.Adapter<DetailRecyclerHolder>{

	private List<LawModel> list;
	private Context mContext;
	
	
	public List<LawModel> getList() {
		return list;
	}

	public void setList(List<LawModel> list) {
		this.list = list;
	}

	public Law_DetailAdapter(Context context) {
		this.mContext = context;
	}

	@Override
	public int getItemCount() {
		return list.size();
	}

	@Override
	public void onBindViewHolder(@NonNull DetailRecyclerHolder holder, final int position) {
      	holder.getTv_detail_img().setImageResource(list.get(position).getImg());
      	holder.getTv_detail_title().setText(list.get(position).getTitle());
	}

	@NonNull
	@Override
	public DetailRecyclerHolder onCreateViewHolder(@NonNull ViewGroup arg0, int arg1) {
		View view = LayoutInflater.from(mContext).inflate(R.layout.item_layout_detail, arg0,false);
		return new DetailRecyclerHolder(view);
	}

}

